home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Sample.bin / RoundHrefButtonArea.java < prev    next >
Text File  |  1998-09-15  |  3KB  |  67 lines

  1. /*
  2.  * @(#)RoundHrefButtonArea.java    1.7 98/03/18
  3.  *
  4.  * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
  7.  * modify and redistribute this software in source and binary code form,
  8.  * provided that i) this copyright notice and license appear on all copies of
  9.  * the software; and ii) Licensee does not utilize the software in a manner
  10.  * which is disparaging to Sun.
  11.  *
  12.  * This software is provided "AS IS," without a warranty of any kind. ALL
  13.  * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
  14.  * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
  15.  * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
  16.  * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
  17.  * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
  18.  * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
  19.  * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
  20.  * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
  21.  * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
  22.  * POSSIBILITY OF SUCH DAMAGES.
  23.  *
  24.  * This software is not designed or intended for use in on-line control of
  25.  * aircraft, air traffic, aircraft navigation or aircraft communications; or in
  26.  * the design, construction, operation or maintenance of any nuclear
  27.  * facility. Licensee represents and warrants that it will not use or
  28.  * redistribute the Software for such purposes.
  29.  */
  30.  
  31. /**
  32.  * An improved, round, "Fetch a URL" ImageArea class.
  33.  * This class extends the HrefButtonArea Class to make the 3D button
  34.  * a rounded ellipse.  All of the same feedback and operational
  35.  * charactistics as the HrefButtonArea apply.
  36.  *
  37.  * @author     Jim Graham
  38.  * @version     1.7, 03/18/98
  39.  */
  40. class RoundHrefButtonArea extends HrefButtonArea {
  41.     /**
  42.      * The filter used to create the 3D look for the button when it is up.
  43.      */
  44.     RoundButtonFilter roundfilter;
  45.  
  46.     /**
  47.      * Test if the coordinate is inside the round region.  Use the test
  48.      * provided by the filter that creates the 3D look for consistency.
  49.      */
  50.     public boolean inside(int x, int y) {
  51.     return roundfilter.inside(x - X, y - Y);
  52.     }
  53.  
  54.     /**
  55.      * Construct the 3D look images that this area uses to draw the button.
  56.      */
  57.     public void makeImages() {
  58.     roundfilter = new RoundButtonFilter(false, parent.hlpercent,
  59.                         border, W, H);
  60.     upImage = parent.getHighlight(X, Y, W, H, roundfilter);
  61.     downImage = parent.getHighlight(X, Y, W, H,
  62.                     new RoundButtonFilter(true,
  63.                                   parent.hlpercent,
  64.                                   border, W, H));
  65.     }
  66. }
  67.